# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=hwinfo
pkgver=21.60
pkgrel=2
pkgdesc="Hardware information tool"
url="https://github.com/openSUSE/hwinfo"
arch="all"
license="GPL-2.0-or-later"
makedepends="$depends_dev flex perl libx86emu-dev linux-headers"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/openSUSE/$pkgname/archive/$pkgver.tar.gz
	respect-flags.patch"
options="!check"  # no tests provided

export HWINFO_VERSION=$pkgver

build() {
	# Build full and tiny static libraries.
	make tinystatic
	make static
	cp src/libhd*.a .
	make clean

	# Build full shared library.
	make shared LIBDIR=/usr/lib
}

package() {
	make install \
		LIBDIR=/usr/lib \
		DESTDIR="$pkgdir"

	rmdir "$pkgdir"/sbin "$pkgdir"/usr/lib || true

	install -m 644 -t "$pkgdir"/usr/lib/ libhd.a libhd_tiny.a

	mkdir -p "$pkgdir"/usr/share/man/man1
	cp doc/*.1 "$pkgdir"/usr/share/man/man1/

	mkdir -p "$pkgdir"/usr/share/man/man8
	cp doc/*.8 "$pkgdir"/usr/share/man/man8/
}

sha512sums="17728e93549d1503764fd0f41fa7caff0afa5833a888ad3b90d594f02b19dac0ffed30507b3da59c8fba5021e1dfa2d89c2a8228e7097d74c9566dbf49c04006  hwinfo-21.60.tar.gz
1a78d21c97bb2b699804c20622b7309573ba3d8dcfdaa8c2c31be42cba42a342e4a4fb451551ee4d1af9384ba455363727cc37839a26550871cca139b5a0ba20  respect-flags.patch"
